<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('user_id')->comment("用户id");
            $table->string("open_id", "32")->unique()->comment("微信用户对应用id");
            $table->string("nick_name")->comment("昵称");
            $table->string("gender")->comment("性别");
            $table->string("city")->comment("城市");
            $table->string("province")->comment("省份");
            $table->string("avatar_url")->comment("头像");
            $table->string("union_id")->comment("对开放平台用户id");
            $table->string("appid")->comment("应用id");
            $table->integer("active")->default(1)->comment("是否活跃");
            $table->integer("subscribe")->default(1)->comment("是否关注");
            $table->timestamp("timestamp")->index()->comment("微信时间戳");
            $table->timestamp("create_time")->index()->comment("创建时间");
            $table->timestamp("end_time")->index()->comment("更新时间");
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
